home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Small Eiffel 0.4.8 / lib_show / bench2 / bench.e < prev    next >
Encoding:
Text File  |  1997-04-13  |  1.2 KB  |  68 lines  |  [TEXT/ttxt]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. deferred class BENCH
  5.    --
  6.    -- Comparison :  ARRAY, FIXED_ARRAY, LINK_LIST and LINK2_LIST.
  7.    --
  8.  
  9. feature
  10.  
  11.    -- According to the power of your computer, set `tuning'
  12.    -- to a good positive value. Default is for very small 
  13.    -- computer :
  14.    tuning: INTEGER is 1; -- 500000; 
  15.  
  16. feature {NONE}
  17.    
  18.    cltn: COLLECTION[INTEGER] is
  19.       deferred
  20.       end;
  21.  
  22.    count: INTEGER is
  23.       do
  24.      Result := 1 + tuning;
  25.       end;
  26.  
  27.    frozen bench is
  28.       require
  29.      cltn.count = count
  30.       do
  31.      increment(cltn,1);
  32.      increment(cltn,1);
  33.      increment(cltn,-2);
  34.      check_all(cltn,0);
  35.       end;
  36.  
  37.    increment(c: like cltn; value: INTEGER) is
  38.       local
  39.      i: INTEGER;
  40.       do
  41.      from
  42.         i := c.upper;
  43.      until
  44.         i = c.lower
  45.      loop
  46.         c.put(c.item(i-1),i);
  47.         i := i - 1;
  48.      end;
  49.       end;
  50.  
  51.    check_all(c: like cltn; value: DOUBLE) is
  52.       local
  53.      i: INTEGER;
  54.       do
  55.      from
  56.         i := c.upper;
  57.      until
  58.         i = c.lower
  59.      loop
  60.         if c.item(i) /= value then
  61.            std_output.put_string("Error in bench.%N");
  62.         end;
  63.         i := i - 1;
  64.      end;
  65.       end;
  66.  
  67. end
  68.